package org.example.myleet.p455;

import java.util.Arrays;

public class Solution {
    /**
     * 8 ms
     */
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int result = 0, i = 0, j = 0;
        while (i < g.length && j < s.length) {
            if (g[i] > s[j]) {
                ++j;
            } else {
                ++result;
                ++i;
                ++j;
            }
        }
        return result;
    }
}
